﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;

    public class NeighborNavigator extends Decoration {

        private const NEIGHBORNAVIGATOR:String = "neighborNavigator";

        protected var m_playActionCallback:Function;
        private var m_containsNeighbor:Boolean;
        private var m_neighborBillboard:Bitmap;
        private var m_neighborPic:Bitmap;
        private var m_currentTopNeighbor:Player;

        public function NeighborNavigator(_arg1:String=null){
            super(_arg1);
            setState(STATE_STATIC);
            m_typeName = this.NEIGHBORNAVIGATOR;
            this.m_neighborBillboard = null;
            this.m_neighborPic = null;
        }
        public function setPlayActionCallback(_arg1:Function):void{
            this.m_playActionCallback = _arg1;
        }
        public function set containsNeighbor(_arg1:Boolean):void{
            this.m_containsNeighbor = _arg1;
        }
        public function get containsNeighbor():Boolean{
            return (this.m_containsNeighbor);
        }
        public function set neighborBillboard(_arg1:Bitmap):void{
            this.m_neighborBillboard = _arg1;
        }
        public function get neighborBillboard():Bitmap{
            return (this.m_neighborBillboard);
        }
        public function set neighborPic(_arg1:Bitmap):void{
            this.m_neighborPic = _arg1;
        }
        public function get neighborPic():Bitmap{
            return (this.m_neighborPic);
        }
        public function set currentTopNeighbor(_arg1:Player):void{
            this.m_currentTopNeighbor = _arg1;
        }
        public function get currentTopNeighbor():Player{
            return (this.m_currentTopNeighbor);
        }
        public function displayFriendPicOnBillboard():void{
            this.m_neighborPic.x = (this.m_neighborBillboard.x + 5.5);
            this.m_neighborPic.y = (this.m_neighborBillboard.y + 0.5);
            this.m_neighborPic.scaleX = (this.m_neighborPic.scaleY = 0.2);
            getDisplayObject().parent.addChild(this.m_neighborPic);
        }
        public function loadTopFriendPicture():void{
            var url:* = null;
            var icon:* = null;
            var dispObj:* = null;
            if (((this.m_currentTopNeighbor) && (this.m_currentTopNeighbor.snUser))){
                url = this.m_currentTopNeighbor.snUser.picture;
            };
            if (url){
                icon = LoadingManager.load(url, function (_arg1:Event):void{
                    var _local2:*;
                    if (((icon) && (icon.content))){
                        _local2 = icon.content;
                        _local2.width = 50;
                        _local2.height = 50;
                        m_neighborPic = _local2;
                        displayFriendPicOnBillboard();
                    };
                });
            } else {
                dispObj = new EmbeddedArt.hud_no_profile_pic();
                dispObj.width = 50;
                dispObj.height = 50;
                this.m_neighborPic = (dispObj as Bitmap);
                this.displayFriendPicOnBillboard();
            };
        }
        override public function isSellable():Boolean{
            return (false);
        }
        override public function onPlayAction():void{
            if (!Global.isVisiting()){
                super.onPlayAction();
                if (this.m_playActionCallback != null){
                    this.m_playActionCallback();
                };
            };
        }
        override public function canBeDragged():Boolean{
            return (false);
        }
        override public function setHighlighted(_arg1:Boolean, _arg2:uint=16755200):void{
            if (((!(Global.world.isEditMode)) && (!(Global.isVisiting())))){
                super.setHighlighted(_arg1);
            };
        }
        override public function showObjectBusy():void{
        }

    }
}//package Classes 
